import type { ColumnDef } from "@tanstack/react-table";

export type TestResult = {
	id: string;
	title: string;
	description: string;
	status: "passed" | "failed" | "skipped" | "broken" | "unknown";
	tags: string[];
	severity: "trivial" | "minor" | "normal" | "critical" | "blocker";
	owner: string;
	duration: string;
	suite: string;
};

export const columns: ColumnDef<TestResult>[] = [
	{
		accessorKey: "suite",
		header: "Suite",
	},
	{
		accessorKey: "title",
		header: "Title",
	},
	{
		accessorKey: "description",
		header: "Description",
	},
	{
		accessorKey: "tags",
		header: "Tags",
		cell: ({ row }) => {
			const tags = row.original.tags;
			return (
				<div className="flex items-center gap-2">
					{tags.map((tag) => (
						<p key={tag}>{tag}</p>
					))}
				</div>
			);
		},
	},
	{
		accessorKey: "severity",
		header: "Severity",
	},
	{
		accessorKey: "owner",
		header: "Owner",
	},
	{
		accessorKey: "duration",
		header: "Duration",
	},
];
